﻿
@{
    ViewBag.Title = "LawDocumentAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css{
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <style>
        .required {
            color: red;
        }
    </style>
}

<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>编辑法律法规文件</a>
            </li>
            <li class="crumb-trail">文件管理</li>
            <li class="crumb-trail">法律法规</li>
        </ol>
    </div>
</header>

<div id="content" ng-cloak ng-controller="LawController" ng-init="DataLoading=false;LoadingMsg='正在导入...';
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     Id='@(Request.QueryString["Id"].IsEmpty() ? "1" : Request.QueryString["Id"])';
     GetLawCategoryList();
     GetOrgLevel();
     GetLawFormModel(Id);">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">编辑法律法规文件</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>文件编号</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" placeholder="必填项" ng-model="LawForm.DocumentNo" />
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>文件名称</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" placeholder="必填项" ng-model="LawForm.DocumentName" />
                            </div>
                            <div class="col-lg-1">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>生效时间</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" placeholder="必填项" format="L" ng-model="LawForm.ValidTime"></datepicker>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>类别</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="LawForm.CategoryId" placeholder="">
                                    <option value="" selected>请选择类别</option>
                                    <option ng-repeat="x in CategoryList" value="{{x.Id}}">{{x.CategoryName}}</option>
                                </select>
                            </div>
                            <div class="col-lg-1">

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>发布机构</label>
                            <div class="col-lg-3">
                                <select id="select_org" class="selectpicker show-tick form-control" multiple data-live-search="true">
                                </select>
                            </div>
                            <div class="col-lg-1">
                                <a class="btn btn-primary" data-toggle="modal" href="#EditModal">添加发布机构</a>
                            </div>
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>发布机构级别</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="LawForm.OrgLevelId">
                                    <option value="" selected>请选择发布机构级别</option>
                                    <option ng-repeat="x in OrgLevelList" value="{{x.Id}}">{{x.OrgLevelName}}</option>
                                </select>
                            </div>
                            <div class="col-lg-1">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label"><b class="required">*</b>发布时间</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="LawForm.PublishTime"></datepicker>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-1 control-label">替代文件</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="LawForm.ReplaceDocument"/>
                            </div>
                            <div class="col-lg-1">

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label">关键字</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" placeholder="多个以“，”号隔开" ng-model="LawForm.Keywords" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label">材料说明</label>
                            <div class="col-lg-8">
                                <textarea class="form-control" rows="5" ng-model="LawForm.Description">

                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label">备注</label>
                            <div class="col-lg-8">
                                <textarea class="form-control" rows="5" ng-model="LawForm.Remark">

                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">已有文件：</label>
                            <div class="col-sm-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="LawForm.FileList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in LawForm.FileList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeleteHiddenTroubleFile(x.Id,HiddenTroubleEditModel.FileList);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-1 control-label">上传附件</label>
                            <div class="col-lg-8">
                                <input type="file" ngf-select ng-model="doc.Files" name="docfiles" id="docfiles" class="file" initialPreviewAsData="true" data-show-remove="true" data-show-preview="true" showCancel="false" data-show-upload="false" required>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="panel-footer">
                    <div class="col-lg-2"></div>
                    <button type="button" class="btn btn-info" ng-disabled="DataLoading" ng-click="EditDocument(LawForm,0,page);">保存</button>
                    <button type="button" class="btn btn-primary" ng-disabled="DataLoading" ng-click="EditDocument(LawForm,1,page);">发布</button>
                    <div class="col-lg-2"></div>
                    <a href="LawDocumentPageList?page={{page}}" class="btn btn-warning">返回</a>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">添加发布机构</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">机构名称：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="OrgModel.OrgName">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="AddPublishOrg(OrgModel);">保存</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>

@section Js{
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/Law.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
        $(".selectpicker").selectpicker({
            noneSelectedText: "请选择发布机构"
        });
    </script>
}
